package org.aplombh.java.interview.leetcode;

public class _1614_括号的最大嵌套深度 {
    public int maxDepth(String s) {
        int res = 0, num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '(') num++;
            if (s.charAt(i) == ')') num--;
            res = Math.max(res, num);
        }
        return res;
    }
}